﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Decorator
{
    public class Decorator : Component
    {
        protected Component _component;

        
        public void SetComponent(Component component)  // 设置Component
        {
            this._component = component;
        }

        // 重写 Operation() ,实际执行的是 Component 的 Operation
        public override void Operation()
        {
            if (this._component != null) 
            {
                _component.Operation();
            }
        }
    }
}
